home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / IBPalettes / WW3DKit / proctext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  1.3 KB  |  42 lines

  1.  
  2. /*
  3.  * Declarations and preprocessor definitions for procedural texture function
  4.  * library.
  5.  * Darwyn Peachey, June, 1994.
  6.  */
  7.  
  8. #ifndef _PROCTEXT_H_
  9. #define _PROCTEXT_H_ 1
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <math.h>
  14.  
  15. #define FLOOR(x) ((int)(x) - ((x) < 0 && (x) != (int)(x)))
  16. #define CEIL(x) ((int)(x) + ((x) > 0 && (x) != (int)(x)))
  17. #define CLAMP(x,a,b) ((x) =< (a) ? (a) : ((x) >= (b) ? (b) : (x)))
  18. #define LERP(t,x0,x1)  ((x0) + (t)*((x1)-(x0)))
  19.  
  20. #define PULSE(a,b,x) (step((a),(x)) - step((b),(x)))
  21. #define boxstep(a,b,x) clamp(((x)-(a))/((b)-(a)),0,1)
  22.  
  23. extern float Abs(float x);    /* the name "abs" is already in use */
  24. extern float bias(float b, float x);
  25. extern float clamp(float x, float a, float b);
  26. extern float gain(float g, float x);
  27. extern float gammacorrect(float gamma, float x);
  28. extern float max(float a, float b);
  29. extern float min(float a, float b);
  30. extern float mod(float a, float b);
  31. extern float smoothstep(float a, float b, float x);
  32. extern float spline(float x, int nknots, float *knot);
  33. extern float step(float a, float x);
  34.  
  35. extern float gnoise(float x, float y, float z);
  36. extern float gvnoise(float x, float y, float z);
  37. extern float scnoise(float x, float y, float z);
  38. extern float vcnoise(float x, float y, float z);
  39. extern float vnoise(float x, float y, float z);
  40.  
  41. #endif /* _PROCTEXT_H_ */
  42.